package br.com.sovi.gwt.client.historico;

import br.com.sovi.gwt.client.historico.marcador.MarcadorInfoController;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.maps.client.MapWidget;

public class ChangePontoClickHandler implements ClickHandler {

	private HistoricoMarker marker;

	private final MapWidget map;

	public ChangePontoClickHandler(MapWidget map) {
		super();
		this.map = map;
	}

	public ChangePontoClickHandler(HistoricoMarker historicoMarker, MapWidget map) {
		this.marker = historicoMarker;
		this.map = map;
	}

	@Override
	public void onClick(ClickEvent event) {
		map.panTo(marker.getLatLng());
		MarcadorInfoController.setMarker(marker);
	}

	public void setMarker(HistoricoMarker marker) {
		this.marker = marker;
	}
}
